<!DOCTYPE html>
<html>
<head>
    <title>印刷商品工艺价格</title>
    <#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList" style="width: 98%">
        <el-row :gutter="30">
            <!--左侧table显示-->
            <el-col :span="9" >
                <div style="padding-bottom: 15px">
                    <el-button-group>
                        <el-button type="primary" size="small" icon="el-icon-plus" @click="addGoodsCraft">增加</el-button>
                        <el-button type="success" size="small" icon="el-icon-share">导出</el-button>
                    </el-button-group>
                </div>

                <div >
                    <el-table
                            ref="yinshuaCraftAttributeTable"
                            :data="yinshuaGoodsCraftAttributeData"
                            border="true"
                            size="small"
                            highlight-current-row="true"
                            style="width: 100%"
                            max-height="650"
                            @row-click="goodsCraftAttributeClicked"
                         >
                        <el-table-column
                                prop="attributeName"
                                label="工艺名称"
                                >
                        </el-table-column>
                      <!--  <el-table-column
                                prop="name"
                                label="工厂名称"
                                width="120">
                        </el-table-column>-->
                        <el-table-column
                                prop="craftFormula"
                                label="算价方式"
                                >
                        </el-table-column>

                        <!--<el-table-column
                                label="操作"
                                width="100">
                            <template slot-scope="scope">
                                <el-button
                                        @click.native.prevent.stop="deleteCraftAttribute(scope.$index, yinshuaGoodsCraftAttributeData)"
                                        size="mini"
                                        icon="el-icon-delete"
                                        type="danger"
                                        size="small">
                                    删除
                                </el-button>
                            </template>
                        </el-table-column>-->
                    </el-table>
                </div>
            </el-col>
            <!--右侧table显示-->
            <el-col :span="15">
                <div style="padding-bottom: 15px">
                    <el-button-group >
                        <el-button type="primary" size="small"  icon="el-icon-news" @click="saveGoodsCraftPrice">批量保存</el-button>
                        <el-button type="warning" size="small" icon="el-icon-setting" @click="oneKeySetPrice">一键设价</el-button>
                        <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteCraftPrice">删除</el-button>
                    </el-button-group>
                </div>
                <div>
                    <el-table
                            ref="yinshuaCraftOptionTable"
                            :data="yinshuaCraftOptionData"
                            @select="goodsCraftOptionSelected"
                            @select-all="goodsCraftOptionSelectedAll"
                            stripe="true"
                            border="true"
                            size="small"
                            highlight-current-row="true"
                            style="width: 100%"
                            max-height="650"
                            >
                        <el-table-column  type="selection"  width="55"> </el-table-column>

                        <el-table-column  prop="optionName" label="选项名称"></el-table-column>

                        <el-table-column label="单价(元)" width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.unitPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column  label="每张最低消费(元)"  width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.minUnitPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column prop="province" label="起步价(开机费)元" width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.minBeginPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column prop="province" label="模板费元" width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.fixedPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column   label="利润系数" width="100">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.floatCoefficient" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column   label="阶梯价格" width="100">
                            <template slot-scope="scope">
                                <el-popover trigger="hover" placement="top" >
                                    <p>{{ scope.row.stepPrice }}</p>
                                    <div slot="reference" class="name-wrapper">
                                        <el-button size="small" slot="append" icon="el-icon-setting" @click="openStepPriceDialog(scope.row)">阶梯价</el-button>
                                    </div>
                                </el-popover>

                            </template>
                        </el-table-column>

                    </el-table>
                </div>
            </el-col>
        </el-row>

        <!--印刷商品工艺 弹窗-->
        <el-dialog
                title="增加工艺"
                :visible.sync="yinshuaGoodsAttributeDialogVisible"
                width="600px"
                >
            <div>
                <el-table
                        ref="yinshuaGoodsCraftTable"
                        :data="yinshuaGoodsCraftData"
                        stripe="true"
                        border="true"
                        size="small"
                        highlight-current-row="true"
                        style="width: 100%"
                        max-height="400">
                    <el-table-column
                            type="selection"
                            width="55">
                    </el-table-column>
                    <el-table-column
                            fixed
                            prop="attributeName"
                            label="工艺"
                            width="200">
                    </el-table-column>
                    <el-table-column
                            fixed
                            prop="craftFormula"
                            label="算价方式"
                            >
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="80">
                        <template slot-scope="scope">
                            <el-button
                                    @click.native.prevent="addToLeftTable(scope.$index)"
                                    type="text"
                                    size="small">
                                加入
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>

            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="yinshuaGoodsAttributeDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="addSelectedToLeftTable">加入</el-button>
            </span>
        </el-dialog>

        <!--阶梯价格弹窗-->
        <el-dialog
                title="阶梯价格设置"
                :visible.sync="stepPriceDialogVisible"
                width="600px"
        >
            <div>
                <el-table
                        ref="stepPriceTable"
                        :data="stepPriceData"
                        stripe="true"
                        border="true"
                        size="small"
                        highlight-current-row="true"
                        style="width: 100%"
                        max-height="400">

                    <el-table-column  label="开始数量" width="100">
                        <template slot-scope="scope">
                            <el-input size="small" v-model="scope.row.beginNum" ></el-input>
                        </template>
                    </el-table-column>

                    <el-table-column  label="结束数量" width="100">
                        <template slot-scope="scope">
                            <el-input size="small" v-model="scope.row.endNum" ></el-input>
                        </template>
                    </el-table-column>

                    <el-table-column  label="单价" width="100">
                        <template slot-scope="scope">
                            <el-input size="small" v-model="scope.row.singlePrice" ></el-input>
                        </template>
                    </el-table-column>

                    <el-table-column  label="备注" width="150">
                        <template slot-scope="scope">
                            <el-input size="small" v-model="scope.row.remark" ></el-input>
                        </template>
                    </el-table-column>

                    <el-table-column
                            label="操作"
                            width="100">
                        <template slot-scope="scope">
                            <el-button
                                    @click.native.prevent="addOneStepPrice"
                                    type="text"
                                    size="small">
                                添加
                            </el-button>
                            <el-button
                                    @click.native.prevent="deleteOneStepPrice(scope.$index, stepPriceData)"
                                    type="text"
                                    size="small">
                                删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>

            </div>
            <span slot="footer" class="dialog-footer">
                <el-button size="small" @click="stepPriceDialogVisible = false">取 消</el-button>
                <el-button size="small" type="primary" @click="saveStepPrice">保存</el-button>
            </span>
        </el-dialog>

    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/goodsCraftPrice/yinshuaCraftPrice.js?_${.now?long}"></script>
</body>
</html>